package com.edu.whty.service.base;

import com.edu.whty.entity.system.TbSysEduResPlatform;
import com.edu.whty.entity.system.*;

import java.util.List;
import java.util.Map;

/**
 * 多平台配置Service
 *
 * @author shijiapeng
 * @date 2015年8月24日 下午6:45:20
 */
public interface ConfigService {

    /**
     * 获取一条配置，如果有多条取第一条
     *
     * @param platformCode
     * @param keyName
     * @return
     * @throws Exception
     */
    public SysConfigPo loadSysConfigPo(String platformCode, String keyName) throws Exception;

    public List<SysDomain> listAllSysDomain() throws Exception;

    /**
     * 按条件获取平台配置
     *
     * @return
     */
    public List<SysConfigPo> listSysConfig(Map<String, Object> paramMap) throws Exception;

    /**
     * 按接口条件获取平台配置
     *
     * @return
     */
    public List<SimpleConfig> listSimpleConfig(ConfigRo ro) throws Exception;

    public String getDomainId(String domain) throws Exception;

    public String getDomainByPlatformCode(String platformCode) throws Exception;

    public void saveVirtualPlatform(ConfigRequest param) throws Exception;

    /**
     * 保存域名信息，并拷贝标准模板配置
     *
     * @param config
     * @throws Exception
     */
    public void saveSysDomain(SysDomain domain) throws Exception;

    /**
     * /**
     * 修改域名信息，如果platformCode修改了，则一并修改子表platformCode信息
     *
     * @param domain
     * @throws Exception
     */
    public void updateSysDomain(SysDomain domain) throws Exception;

    /**
     * 批量修改接口地址
     *
     * @param config
     * @throws Exception
     */
    public void updateApiAddress(SysConfigPo config) throws Exception;

    public void saveSysConfig(SysConfigPo config) throws Exception;

    /**
     * 删除域名及关联的配置信息
     *
     * @throws Exception
     */
    public void deleteDomainAndConfig(String domainId) throws Exception;

    public void deleteSysConfigById(String configId) throws Exception;

    /**
     * 删除所有keyName名称的配置
     *
     * @param keyName
     * @return
     * @throws Exception
     */
    public int deleteSysConfigByKeyName(String keyName) throws Exception;

    public void updateSysConfig(SysConfigPo config) throws Exception;

    public SysDomain loadSysDomainById(String domainId) throws Exception;

    public SysConfigPo loadSysConfigById(String configId) throws Exception;

    /**
     * 查询是否已存在配置
     *
     * @param domainId
     * @param keyName
     * @return
     * @throws Exception
     */
    public boolean haveExistConfig(String domainId, String keyName) throws Exception;

    public List<SysDomain> listSysDomain(Map<String, Object> paramMap) throws Exception;

    /**
     * 获取目前配置分类信息（每个分类取一条记录）
     *
     * @param domainId
     * @return
     * @throws Exception
     */
    public List<SysConfigPo> listConfigType(String domainId) throws Exception;

    /**
     * 获取用户机构信息Url
     */
    public List<SysConfigPo> queryUserOrgValue();

    /**
     * 根据平台编码查询授权模块
     */
    @SuppressWarnings("rawtypes")
    public List<Map> queryModel(String platformCode) throws Exception;

    /**
     * 保存平台模块关联数据
     */
    public void savePlatformModel(String platformCode, List<String> list) throws Exception;

    /**
     * 保存虚拟平台配置(分销系统专用)
     */
    public void saveVirtualPlatformFx(ConfigRequest param) throws Exception;

    public String queryConfigValue(String key, String platformCode, String loginPlatformCode) throws Exception;

    public List<Map<String, Object>> getTbSysConfigOthers(Map<String, Object> param);

    public List<TbSysEduResPlatform> getEduResParam(Map<String, Object> param);

    String queryPlatformDomain(Map<String, Object> param);

    String queryConfigValueByDomainId(Map<String, Object> paramMap);

    SysDomain getSysDomain(String domain);

}
